package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.T25;
import com.ruoyi.service.IT25Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 套餐Controller
 *
 * @author ruoyi
 * @date 2025-04-13
 */
@RestController
@RequestMapping("/system/T25")
public class T25Controller extends BaseController
{
    @Autowired
    private IT25Service t25Service;

    /**
     * 查询套餐列表
     */
    @GetMapping("/list")
    public TableDataInfo list(T25 t25)
    {
        startPage();
        List<T25> list = t25Service.selectT25List(t25);
        return getDataTable(list);
    }
    @GetMapping("/getList")
    public AjaxResult getList(T25 t25)
    {
        List<T25> list = t25Service.selectT25List(t25);
        return success(list);
    }

    /**
     * 导出套餐列表
     */
    @Log(title = "套餐", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, T25 t25)
    {
        List<T25> list = t25Service.selectT25List(t25);
        ExcelUtil<T25> util = new ExcelUtil<T25>(T25.class);
        util.exportExcel(response, list, "套餐数据");
    }

    /**
     * 获取套餐详细信息
     */
    @GetMapping(value = "/{F2501}")
    public AjaxResult getInfo(@PathVariable("F2501") Long F2501)
    {
        return success(t25Service.selectT25ByF2501(F2501));
    }

    /**
     * 新增套餐
     */
    @Log(title = "套餐", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody T25 t25)
    {
        return toAjax(t25Service.insertT25(t25));
    }

    /**
     * 修改套餐
     */
    @Log(title = "套餐", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody T25 t25)
    {
        return toAjax(t25Service.updateT25(t25));
    }

    /**
     * 删除套餐
     */
    @Log(title = "套餐", businessType = BusinessType.DELETE)
	@DeleteMapping("/{F2501s}")
    public AjaxResult remove(@PathVariable Long[] F2501s)
    {
        return toAjax(t25Service.deleteT25ByF2501s(F2501s));
    }
}
